package edu.neu.agv_backend.service;

import edu.neu.agv_backend.dto.AjaxResult;
import edu.neu.agv_backend.remote.RemoteClient;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

@Service
public class MovementService {

    private final RemoteClient client;

    public MovementService(RemoteClient client) {
        this.client = client;
    }

    public AjaxResult<Void> heartbeat() {
        ResponseEntity<AjaxResult> resp = client.get("/agv/movement/heartbeat", AjaxResult.class);
        return resp.getBody();
    }

    public AjaxResult<Void> forward() {
        ResponseEntity<AjaxResult> resp = client.post("/agv/movement/forward", null, AjaxResult.class);
        return resp.getBody();
    }

    public AjaxResult<Void> stop() {
        ResponseEntity<AjaxResult> resp = client.post("/agv/movement/stop", null, AjaxResult.class);
        return resp.getBody();
    }

    public AjaxResult<Void> backward() {
        ResponseEntity<AjaxResult> resp = client.post("/agv/movement/backward", null, AjaxResult.class);
        return resp.getBody();
    }
} 